package test.service.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * Created by 张少昆 on 2017/12/24.
 */
@Service
public class MyUserDetailsService implements UserDetailsService { //TODO 或者继承 JdbcDaoImpl
    // @Autowired
    // private UserRepo userRepo;
    // @Autowired
    // private AuthorityRepo authorityRepo;
    // @Autowired
    // private RoleRepo roleRepo;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{
        //根据username查找并返回UserDetails对象 - 可以使用Spring Security内置的User类，也可以自定义，当然需要实现UserDetails接口
        // return User.withUsername(username).password().roles().authorities().disabled().accountLocked().accountExpired().credentialsExpired().build();
        return null;
    }
}
